'''
@auther tianxiaoxi  
@file login by
@time 2021/12/22 20:15
'''

import app
import requests


class LoginAPI:
    # 初始化
    def __init__(self):
        self.url_login = app.BASE_URL + "/api/sys/login"

    def login(self, login_data):
        return requests.post(url=self.url_login, json=login_data)

    def token_login(self):
        request = requests.post(url=self.url_login, json=app.login_data)
        app.TOKEN = request.json().get("data")
